<?php
class Pagination extends Component{
	public function output(){
		$pagination = $this->params['pagination'];
		if(!$pagination instanceof Mpagination){
			throw new Dexception('No pagination Model Matched!');
		}

	}
}


/**
 * pagination 模型
 */
class Mpagination extends item implements ArrayAccess{
	public $page;
	public $pagesize;
	public $total;
	public $prefix;
	public $pageVar='page';


	private $container;


	public function __construct($page,$pagesize,$total,$prefix){
			$this -> page = $page;
			$this -> pagesize = $pagesize;
			$this -> total = $total;
			$this -> prefix = $prefix;


	}

	public function offsetExists($page){
		return isset($this->container[$page]);
	}
	public function offsetGet($page){
		$url = "{$this->prefix}/{$this->pageVar}/$page";
		return $url;
	}
	public function offsetSet($page,$url){
		$this -> container[$page] = $url;
	}
	public function offsetUnset($page){
		unset($this->container[$page]);
	}
}